Objects Reference

class mesh : public base_object

Definition

class mesh : public base_object
{
  public:
   int nv, nf;
   vector *vert;
   vector *vertnorm;
   face **faces;
   face *localfaces;
   int *edges,nedges;
   vector pivotpos;
   boundbox bbox;
   vector color;
   float scrollu,scrollv;
   int lastdraw;

   mesh()
   {
     vert=0; vertnorm=0; faces=0; nv=0; nf=0; localfaces=0;
     color.vec(1.0f,1.0f,1.0f,1.0f);
     scrollu=scrollv=0.0f;
     lastdraw=0;
   };
   virtual ~mesh()
   { reset(); };

   void reset();
   virtual void draw();
   virtual void draw_cartoon(vector& campos,vector& light,light_vertex& lights,float edgewidth);
   virtual void draw_shadow_volume(vector& lightdir);
   int get_edge(int v1,int v2);
   int load_3ds(char *name);
   void compute_normals(int flag=15);
   int ray_intersect(vector& ro,vector& rd,vector& ip,float& dist,float rad=0.0f);
   int ray_intersect_test(vector& ro,vector& rd,float rad=0.0f);
   void illum_faces(vector& ip,float d_max,vector& c,int shadows);
   void implode(float mindist=0.1f);
   void set_numverts(int nverts,int keep=0);
   void set_numfaces(int nfaces,int local=0,int keep=0);
   mesh *clone();
};

Data Members

Member Type Description
nv int number of vertices in the mesh
nf int number of faces in the mesh
vert vector * the vertices array
vertnorm vector * the vertex normals array
faces face ** the faces pointers array
localfaces face * the faces array
edges int * the edges array (4*sizeof(int)*nedges)
each entry 4 integers: two vertices, two faces
nedges int the number of entries in edges list
pivotpos vector the mesh pivot position
bbox boundbox the mesh bounding box (aabb)
color vector the mesh color multiplier
scrollu float texture co-ordinates scroll factor in u direction
scrollv float texture co-ordinates scroll factor in v direction
lastdraw int last frame the mesh was draw

Methods

reset, draw, draw_cartoon, draw_shadow_volume, get_edge, load_3ds, compute_normals, ray_intersect, ray_intersect_test, illum_faces, implode, set_numverts, set_numfaces, clone

Remarks

This class implements a 3D mesh object. The mesh can have the faces defined in it (localfaces) or it can point to faces outside the mesh (from the bsp) by having the localfaces pointer set to NULL. 

See Also

vector, plane, face, base_object